#ifndef PROPS_H
#define PROPS_H
#pragma once

#include <react/renderer/components/view/ViewProps.h>
#include <react/renderer/core/PropsParserContext.h>

namespace facebook::react {
enum class BlurViewBlurType {
    DARK,
    LIGHT,
    XLIGHT,
    THICK_MATERIAL,
    THIN_MATERIAL,
    EXTRA_DARK,
    REGULAR,
    PROMINENT,
    CHROME_MATERIAL,
    MATERIAL,
    ULTRA_THIN_MATERIAL,
    CHROME_MATERIAL_DARK,
    MATERIAL_DARK,
    ULTRA_THIN_MATERIAL_DARK,
    CHROME_MATERIAL_LIGHT,
    MATERIAL_LIGHT,
    ULTRA_THIN_MATERIAL_LIGHT,
    THICK_MATERIAL_DARK,
    THIN_MATERIAL_DARK,
    THICK_MATERIAL_LIGHT,
    THIN_MATERIAL_LIGHT,
};

inline void fromRawValue(const PropsParserContext &context, const RawValue &value, BlurViewBlurType &result)
{
    auto string = (std::string)value;
    if (string == "dark") {
        result = BlurViewBlurType::DARK;
        return;
    }
    if (string == "light") {
        result = BlurViewBlurType::LIGHT;
        return;
    }
    if (string == "xlight") {
        result = BlurViewBlurType::XLIGHT;
        return;
    }
    if (string == "thickMaterial") {
        result = BlurViewBlurType::THICK_MATERIAL;
        return;
    }
    if (string == "thinMaterial") {
        result = BlurViewBlurType::THIN_MATERIAL;
        return;
    }
    if (string == "extraDark") {
        result = BlurViewBlurType::EXTRA_DARK;
        return;
    }
    if (string == "regular") {
        result = BlurViewBlurType::REGULAR;
        return;
    }
    if (string == "prominent") {
        result = BlurViewBlurType::PROMINENT;
        return;
    }
    if (string == "chromeMaterial") {
        result = BlurViewBlurType::CHROME_MATERIAL;
        return;
    }
    if (string == "material") {
        result = BlurViewBlurType::MATERIAL;
        return;
    }
    if (string == "ultraThinMaterial") {
        result = BlurViewBlurType::ULTRA_THIN_MATERIAL;
        return;
    }
    if (string == "chromeMaterialDark") {
        result = BlurViewBlurType::CHROME_MATERIAL_DARK;
        return;
    }
    if (string == "materialDark") {
        result = BlurViewBlurType::MATERIAL_DARK;
        return;
    }
    if (string == "ultraThinMaterialDark") {
        result = BlurViewBlurType::ULTRA_THIN_MATERIAL_DARK;
        return;
    }
    if (string == "chromeMaterialLight") {
        result = BlurViewBlurType::CHROME_MATERIAL_LIGHT;
        return;
    }
    if (string == "materialLight") {
        result = BlurViewBlurType::MATERIAL_LIGHT;
        return;
    }
    if (string == "ultraThinMaterialLight") {
        result = BlurViewBlurType::ULTRA_THIN_MATERIAL_LIGHT;
        return;
    }
    if (string == "thickMaterialDark") {
        result = BlurViewBlurType::THICK_MATERIAL_DARK;
        return;
    }
    if (string == "thinMaterialDark") {
        result = BlurViewBlurType::THIN_MATERIAL_DARK;
        return;
    }
    if (string == "thickMaterialLight") {
        result = BlurViewBlurType::THICK_MATERIAL_LIGHT;
        return;
    }
    if (string == "thinMaterialLight") {
        result = BlurViewBlurType::THIN_MATERIAL_LIGHT;
        return;
    }
    throw std::runtime_error("Invalid display type");
}

inline std::string toString(const BlurViewBlurType &value)
{
    switch (value) {
        case BlurViewBlurType::DARK:
            return "dark";
        case BlurViewBlurType::LIGHT:
            return "light";
        case BlurViewBlurType::XLIGHT:
            return "xlight";
        case BlurViewBlurType::THICK_MATERIAL:
            return "thickMaterial";
        case BlurViewBlurType::THIN_MATERIAL:
            return "thinMaterial";
        case BlurViewBlurType::EXTRA_DARK:
            return "extraDark";
        case BlurViewBlurType::REGULAR:
            return "regular";
        case BlurViewBlurType::PROMINENT:
            return "prominent";
        case BlurViewBlurType::CHROME_MATERIAL:
            return "chromeMaterial";
        case BlurViewBlurType::MATERIAL:
            return "material";
        case BlurViewBlurType::ULTRA_THIN_MATERIAL:
            return "ultraThinMaterial";
        case BlurViewBlurType::CHROME_MATERIAL_DARK:
            return "chromeMaterialDark";
        case BlurViewBlurType::MATERIAL_DARK:
            return "materialDark";
        case BlurViewBlurType::ULTRA_THIN_MATERIAL_DARK:
            return "ultraThinMaterialDark";
        case BlurViewBlurType::CHROME_MATERIAL_LIGHT:
            return "chromeMaterialLight";
        case BlurViewBlurType::MATERIAL_LIGHT:
            return "materialLight";
        case BlurViewBlurType::ULTRA_THIN_MATERIAL_LIGHT:
            return "ultraThinMaterialLight";
        case BlurViewBlurType::THICK_MATERIAL_DARK:
            return "thickMaterialDark";
        case BlurViewBlurType::THIN_MATERIAL_DARK:
            return "thinMaterialDark";
        case BlurViewBlurType::THICK_MATERIAL_LIGHT:
            return "thickMaterialLight";
        case BlurViewBlurType::THIN_MATERIAL_LIGHT:
            return "thinMaterialLight";
    }
}

class BlurViewProps final : public ViewProps {
public:
    BlurViewProps() = default;
    BlurViewProps(const PropsParserContext &context, const BlurViewProps &sourceProps, const RawProps &rawProps);

#pragma mark - Props

    int blurAmount{};
    BlurViewBlurType blurType{ BlurViewBlurType::DARK };
};
} // namespace facebook::react
#endif // PROPS_H